package cate.game.rank.h;

import cate.common.table.d.GDRank;
import cate.game.rank.po.Rank;
import cate.game.rank.po.RankSPO;

import java.util.ArrayList;
import java.util.List;


public class RankPointRaceHandler extends RankHandler<RankPointRaceHandler.RankPointRaceSPO, Rank>{
    @Override
    protected String getTag() {
        return "point_race";
    }

    @Override
    public RankPointRaceSPO createSPO(){
        return new RankPointRaceSPO();
    }

    @Override
    public int getRankId() {
        return GDRank.Id.POINT_RACE_RANK_ID;
    }

    public static final class RankPointRaceSPO extends RankSPO<Rank>{
        @Override
        protected int getRankNum() {
            return 10000;
        }
    }

    /** 拷贝排行榜指定数量的玩家信息 */
    public synchronized List<Rank> copyList(int rank) {
        List<Rank> result = new ArrayList<>();
        for (Rank rank1 : this.getRankList(null)) {
            if (result.size() < rank) {
                result.add(rank1.copy());
            } else {
                return result;
            }
        }
        return result;
    }
}
